<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>帖子界面</title>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <%@include file="../includes/common.jsp" %>
    <%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
    <%@ page contentType="text/html;charset=UTF-8" %>

    <link rel="stylesheet" type="text/css"  href="<c:url value="/js/css/spigPet.css"/>"/>
    <link rel="stylesheet" type="text/css" href="<c:url value="/js/css/jquery.tmailsilder.v2.css"/> "/>

</head>
<body>
<div class="container-fluid" style="padding: 0">
    <div class="row-fluid">

            <div >

                <label style="font-size: 20px; border-top-width: 10px; margin-top: 10px; margin-bottom: 10px; text-align: center">${posts.topic}</label>     <br />
            </div>
            <div style="text-align: center">
            <c:forEach items="${postsList}" var="reply">
            <div  style="margin-left: 100px; width: 800px;" >
                 <div style="float: left;width: 80px;height: 150px">
                     <label>${reply.showLoginName}</label>
                     <label>${reply.replyTime}</label>
                 </div>
                <div style="margin-left: 10px;width: 700px;height: 150px;float: left">
                    <textarea style="width: 780px;height: 100px; resize: none" maxlength="10">${reply.replyContent}</textarea>
                </div>
            </div>
            </c:forEach>
            </div>
        </div>
    </div>
    <div id="posts" style="margin-left: 190px;margin-top: 10px; width: 800px;height: 300px;" >
        <label style="font-size: 20px;">发表回复</label>
        <textarea style="width: 780px;height: 180px;resize: none" id="replyContent" ></textarea>
        <div style="width: 780px;height: 10px;text-align: right">
            <input type="button" class="btn btn-primary" onclick="saveReply()" value="发表"/>

        </div>
    </div>

</div>
<div id="dataEdit" closed="true" modal="true" style="overflow: hidden">
    <iframe style="width: 100%;height: 100%"
            id="contentFrame"
            name="contentFrame"
            marginheight="0"
            marginwidth="0"
            frameborder="0" src=""
            allowTransparency="true">
    </iframe>
</div>
</body>
</html>
<script type="text/javascript">
    function saveReply(){
        $.ajax({
            url: basePath + "consumer/addPostReply",
            data: {
                postId:${posts.id},
                replyContent:$("#replyContent").val().trim(),
                replyTime: showLocale(new Date())
            },
            dataType:"json",
            type:"POST",
            success:function(){
                $.messager.alert("成功", "发表成功！", "", function () {
                    window.location.href=basePath+"consumer/findOnePost?postId="+${posts.id};
                })
            },
            error:doError

        });
    }

</script>

